// This section begins the data held in the "objMLB" object
// Normally, this would be in a database and would be available via Ajax or some other method
var currentItem = 1;
objMLB = {
	headlineText: [
		
	], // headlineText
	
	extURL: [
		
	] // descText

}; // objMLB ends here

function loadFocus(){
	if(bXmlHttpSupport) {
    	var sUrl = 'loadSettingsPage.action';
    	var params = "category=系统选项&title=焦点图管理&item=Focus&setKey=Home";
        var request = new XMLHttpRequest();
        request.onreadystatechange = function() {
        	if(request.readyState == 4) {
        		//alert(request.responseText);
            	querySettings();
			}
    	};
    	request.open('POST', sUrl);
    	request.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
    	request.send(params);
    }
}

function querySettings(){
	if(bXmlHttpSupport) {
    	var sUrl = "queryFocus.action";
    	var params ="";
        var request = new XMLHttpRequest();
        request.onreadystatechange = function() {
        	if(request.readyState == 4) {
            	var oRequest = eval('(' + request.responseText + ')');
            	//alert(request.responseText);
            	var settings = oRequest.settings;
            	showFocus(settings);
			}
    	};
    	request.open('POST', sUrl);
    	request.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
    	request.send(params);
    }
}

function showFocus(settings){
	initPic1.innerHTML = settings.settingsImg[0].title;
	initPic2.innerHTML = settings.settingsImg[0].title;
	for (var i = 0; i < 6; i++){
		objMLB.headlineText[i] = settings.settingsImg[i].title;
	}
	var photos = document.getElementById("photos");
	var img1 = photos.getElementsByTagName("img");
	for (var i = 0; i < img1.length; i++){
		img1[i].src = "loadSettingsImgByID.action?imgID=" + settings.settingsImg[i].settingsImgID;
	}
	var thumbs = document.getElementById("thumbs");
	var img2 = thumbs.getElementsByTagName("img");
	for (var i = 0; i < img2.length; i++){
		img2[i].src = "loadSettingsImgByID.action?imgID=" + settings.settingsImg[i].settingsImgID;
	}

}
